﻿@using KRM.Core

@model KRM.Core.tblOrder
@{
    ViewBag.Title = "Send message to customer";
    Layout = "~/Views/Shared/_PopupLayout.cshtml"; 
}

<form action="/orderview/contactcustomer" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="to" value="@Model.CustomerEmailAddress"/>
    <input type="hidden" name="message" value="@ViewBag.Content"/>
    <input type="hidden" name="orderid" value="@Model.OrderID"/>
    <div class="row-fluid">
        @Html.Partial("Partial/_MessageResult")
        <div style="width: 35%; float: left">
            <div class="customer-box">
                <p class="customer-box-title">Client's Details</p>
                <div class="customer-box-bg">
                    <table>
                        <tr>
                            <td>Client's Name: </td>
                            <td><strong>@ViewBag.Name</strong></td>
                        </tr>
                        <tr>
                            <td>Email: </td>
                            <td><strong>@Model.CustomerEmailAddress</strong></td>
                        </tr>
                        <tr>
                            <td>Order Number: </td>
                            <td><strong>@Model.OrderRef</strong></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="customer-box">
                <p class="customer-box-title">Company</p>
                <div class="customer-box-bg">
                    <p class="text-center">@Model.Store.StoreName</p>
                </div>
            </div>
            <div class="customer-box">
                <p class="customer-box-title">Message Type</p>
                <div class="text-center" style="padding: 4px 0">
                    <select name="from">
                        <option value="@Model.Store.StoreSupportEmail">Product Support</option>
                        <option value="@Model.Store.PreDeliveryEmail">Pre Delivery</option>
                        <option value="@Model.Store.StoreSalesEmail">Information</option>
                        <option value="cancellations@Kybotech.co.uk">Cancellation</option>
                    </select>
                </div>
            </div>
        </div>
        <div style="width: 35%; float: left">
            <div class="customer-box" style="height: 206px;">
                <p class="customer-box-title">Details</p>
                <div class="customer-box-bg">
                    @Html.DropDownList("EmailSubjectId", null, new { onchange = "emailchange(this.value)" })
                    <a class="btn" href="/orderview/manageemailsubject/@Model.OrderID">Manage email subject</a>
                    <a class="btn" href="/orderview/emailtemplate/@Model.OrderID">Edit template</a>

                </div>
            </div>
        </div>
        <div style="width: 30%; float: left">
            <div class="customer-box" style="height: 206px; overflow: auto">
                <p class="customer-box-title">Attachment</p>
                <div class="customer-box-bg">
                    <input type="checkbox" name="guideline" style="margin: 0 7px 2px 5px;" class="cbattachguideline" />Attach guideline
                    <div class="guidelineattach" style="display: none">
                    @{
                        if (Model.HasWoodenShed())
                        {
                            if (System.IO.File.Exists(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_WoodenSheds))
                            {
                                <p>@(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_WoodenSheds)</p>
                            }
                        }
                        if (Model.HasMetalShed())
                        {
                            if (System.IO.File.Exists(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_MetalSheds))
                            {
                               <p> @(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_MetalSheds)</p>
                            }
                        }
                        if (Model.HasLogCabin())
                        {
                            if (System.IO.File.Exists(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_LogCabins))
                            {
                                <p>@(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_LogCabins)</p>
                            }
                        }
                        if (Model.HasGreenhouse())
                        {
                            if (System.IO.File.Exists(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_GreenHouses))
                            {
                                <p>@(tblCompanyVariable.Files_GuideLines_DiskPath + tblCompanyVariable.Files_GuideLines_GreenHouses)</p>
                            }
                        }
                    }
                        </div>
                        <input type="file" class="multi" name="attachment" style="padding-top: 10px" />
                </div>
            </div>
        </div>
    </div>

    <div class="row-fluid">
        <div class="span12">
            <div class="customer-box">
                <p class="customer-box-title">New message</p>
                <div class="customer-box-bg">
                    <div class="email-content">
                        @Html.Raw(ViewBag.Content)
                    </div>
                    <div style="text-align: right">
                        <button class="btn btn-primary" type="submit">Send Email</button>
                        <button class="btn" onclick="javascript:window.close();">Cancel</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
